home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 68 / IOPROG_68.ISO / soft / Tools / AIProSF / AIProSF.exe / ActiveInstall Professional.msi / Data.cab / ActiveInstall.chm / script / ax.js next >
Encoding:
JavaScript  |  2003-02-10  |  6.8 KB  |  293 lines

  1. // Current language
  2. var curLang;
  3. var showAll;
  4.  
  5. function dxBeforePrint(){
  6.  
  7.     var i;
  8.  
  9.     if (window.text) document.all.text.style.height = "auto";
  10.             
  11.     for (i=0; i < document.all.length; i++){
  12.         if (document.all[i].tagName == "BODY") {
  13.             document.all[i].scroll = "yes";
  14.             }
  15.         if (document.all[i].id == "pagetop") {
  16.             document.all[i].style.margin = "0px 0px 0px 0px";
  17.             document.all[i].style.width = "100%";
  18.             }
  19.         if (document.all[i].id == "pagebody") {
  20.             document.all[i].style.overflow = "visible";
  21.             document.all[i].style.top = "5px";
  22.             document.all[i].style.width = "100%";
  23.             document.all[i].style.padding = "0px 10px 0px 30px";
  24.             }
  25.         if (document.all[i].id == "seealsobutton" || document.all[i].id == "languagesbutton") {
  26.             document.all[i].style.display = "none";
  27.             }
  28.         if (document.all[i].className == "LanguageSpecific") {
  29.             document.all[i].style.display = "block";
  30.             }
  31.         }
  32. }
  33.  
  34. function dxAfterPrint(){
  35.  
  36.      document.location.reload();
  37.  
  38. }
  39.  
  40. function showSeeAlsoBox(){
  41.  
  42.     hideSeeAlso();
  43.     hideLanguage();
  44.     hideBoxes();
  45.  
  46.     var button = window.event.srcElement
  47.  
  48.     window.event.returnValue = false;
  49.     window.event.cancelBubble = true;
  50.  
  51.     var div = document.all.dxseealsomenu;
  52.     if (div && button) {
  53.         div.style.pixelLeft = 0;
  54.         div.style.pixelTop = button.offsetTop + button.offsetHeight;
  55.         div.style.visibility = "visible";
  56.     }
  57. }
  58.  
  59. function showParamBox(){
  60.  
  61.     hideSeeAlso();
  62.     hideLanguage();
  63.     hideBoxes();
  64.  
  65.     var button = window.event.srcElement
  66.     
  67.     window.event.returnValue = false;
  68.     window.event.cancelBubble = true;
  69.  
  70.     var div = document.all[button.id + "_box"]
  71.     if (div && button) {
  72.         div.style.pixelLeft = button.offsetLeft; //window.event.clientX;
  73.         div.style.pixelTop = window.event.clientY+7;
  74.         div.style.width = "30%";
  75.         div.style.visibility = "visible";
  76.     }
  77.  
  78. }
  79.  
  80. function showLanguageBox(){
  81.  
  82.     hideSeeAlso();
  83.     hideLanguage();
  84.     hideBoxes();
  85.  
  86.     var button = window.event.srcElement
  87.  
  88.     window.event.returnValue = false;
  89.     window.event.cancelBubble = true;
  90.  
  91.     var div = document.all.dxlanguagemenu;
  92.     if (div && button) {
  93.         div.style.pixelLeft = 0;
  94.         div.style.pixelTop = button.offsetTop + button.offsetHeight;
  95.         div.style.visibility = "visible";
  96.     }
  97. }
  98.  
  99. function setLanguageFilter(language){
  100.  
  101.     hideSeeAlso();
  102.     hideLanguage();
  103.  
  104.     window.event.returnValue = false;
  105.     window.event.cancelBubble = true;
  106.     
  107.     curLang = language;
  108.     updateLanguageElements();
  109.     
  110. }
  111.  
  112. function bodyLoad(){
  113.  
  114.     var cLang;
  115.     var i;
  116.     var b;
  117.     var l;
  118.     var e;
  119.  
  120.     resizeBan();
  121.     document.body.onclick = bodyClick;
  122.     document.body.onresize = bodyResize;
  123.     
  124.     // Check the context window for current language.
  125.     var cLang;
  126.     try{
  127.         for (i=1; i< window.external.ContextAttributes.Count; i++){
  128.             if(window.external.ContextAttributes(i).Name.toUpperCase()=="DEVLANG"){
  129.                 var b = window.external.ContextAttributes(i).Values.toArray();
  130.                 cLang = b[0].toUpperCase();
  131.             }
  132.         }
  133.     }
  134.     catch(e){}
  135.     
  136.     if (cLang != null){
  137.         if (cLang.indexOf("VB")!=-1) curLang = "VB";
  138.         if (cLang.indexOf("VC")!=-1) curLang = "VC";
  139.         if (cLang.indexOf("C#")!=-1) curLang = "CS";
  140.         if (cLang.indexOf("JSCRIPT")!=-1) curLang = "JScript";
  141.     }
  142.  
  143.     if (curLang == null){
  144.         var l = "";
  145.         var multipleLang = false;
  146.         // Check to see what the help filter is set to.
  147.         try {l = window.external.Help.FilterQuery.toUpperCase();}
  148.         catch(e){}
  149.         if (l.indexOf("VB")!=-1){
  150.             cLang = "VB";
  151.             }
  152.         if (l.indexOf("VC")!=-1){
  153.             if (cLang!=null) multipleLang = true;
  154.             cLang = "VC";
  155.             }
  156.         if (l.indexOf("C#")!=-1){
  157.             if (cLang!=null) multipleLang = true;
  158.             cLang = "CS";
  159.             }
  160.         if (l.indexOf("JSCRIPT")!=-1){
  161.             if (cLang!=null) multipleLang = true;
  162.             cLang = "JScript";
  163.             }
  164.         if (multipleLang==false) curLang = cLang;
  165.     }
  166.  
  167.     if (curLang != null)
  168.         showAll = false;
  169.         
  170.     updateLanguageElements();
  171.     
  172.     window.onbeforeprint = dxBeforePrint;
  173.     window.onafterprint = dxAfterPrint;
  174.     
  175. }
  176.  
  177. function updateLanguageElements(){
  178.  
  179.     if (!curLang) return;
  180.  
  181.     var pres = document.all.tags("DIV");
  182.     var pre;
  183.  
  184.     if (pres) {
  185.         for (var iPre = 0; iPre < pres.length; iPre++) {
  186.             pre = pres[iPre];
  187.             if (pre.Name && pre.className) {
  188.                 if (pre.className == "LanguageSpecific") {
  189.                     if (pre.Name.indexOf(curLang) != -1 || curLang == "All") {
  190.                         pre.style.display = "block";                
  191.                     }
  192.                     else {
  193.                         pre.style.display = "none";
  194.                     };
  195.                 }
  196.             };
  197.         }
  198.     }
  199.     
  200. }
  201.  
  202. function bodyResize(){
  203.     resizeBan();
  204. }
  205.  
  206. function bodyClick(){
  207.     hideSeeAlso();
  208.     hideLanguage();
  209.     hideBoxes();
  210.     resizeBan();
  211. }
  212.  
  213. function hideSeeAlso(){
  214.     if (document.all.dxseealsomenu) {
  215.         document.all.dxseealsomenu.style.visibility = "hidden";
  216.     };
  217. }
  218.  
  219.  
  220. function hideLanguage(){
  221.     if (document.all.dxlanguagemenu) {
  222.         document.all.dxlanguagemenu.style.visibility = "hidden";
  223.     };
  224. }
  225.  
  226. function hideBoxes(){
  227.     var pres = document.all.tags("DIV");
  228.     var pre;
  229.  
  230.     if (pres) {
  231.         for (var iPre = 0; iPre < pres.length; iPre++) {
  232.             pre = pres[iPre];
  233.             if (pre.className) {
  234.                 if (pre.className == "popupbubble") {
  235.                     pre.style.visibility = "hidden";
  236.                 }
  237.             };
  238.         }
  239.     }
  240. }
  241.  
  242. function resizeBan(){
  243.     
  244.     if (msieversion() > 4)
  245.     {
  246.         try
  247.         {
  248.  
  249.             if (document.body.clientWidth==0) return;
  250.             var oBanner= document.all.item("pagetop");
  251.             var oText= document.all.item("pagebody");
  252.             if (oText == null) return;
  253.             var oBannerrow1 = document.all.item("projectnamebanner");
  254.             var oTitleRow = document.all.item("pagetitlebanner");
  255.             if (oBannerrow1 != null){
  256.                 var iScrollWidth = dxBody.scrollWidth;
  257.                 oBannerrow1.style.marginRight = 0 - iScrollWidth;
  258.             }
  259.             if (oTitleRow != null){
  260.                 oTitleRow.style.padding = "0px 10px 0px 22px; ";
  261.             }
  262.             if (oBanner != null){
  263.                 document.body.scroll = "no"
  264.                 oText.style.overflow= "auto";
  265.                 oBanner.style.width= document.body.offsetWidth-2;
  266.                 oText.style.paddingRight = "20px"; // Width issue code
  267.                 oText.style.width= document.body.offsetWidth-4;
  268.                 oText.style.top=0;  
  269.                 if (document.body.offsetHeight > oBanner.offsetHeight)
  270.                     oText.style.height= document.body.offsetHeight - (oBanner.offsetHeight+4) 
  271.                 else oText.style.height=0
  272.             }    
  273.             try{nstext.setActive();} //allows scrolling from keyboard as soon as page is loaded. Only works in IE 5.5 and above.
  274.             catch(e){}
  275.  
  276.         }
  277.         catch(e){}
  278.     }    
  279.  
  280. function msieversion()
  281. // Return Microsoft Internet Explorer (major) version number, or 0 for others.
  282. // This function works by finding the "MSIE " string and extracting the version number
  283. // following the space, up to the decimal point for the minor version, which is ignored.
  284. {
  285.     var ua = window.navigator.userAgent
  286.     var msie = ua.indexOf ( "MSIE " )
  287.  
  288.     if ( msie > 0 )        // is Microsoft Internet Explorer; return version number
  289.         return parseInt ( ua.substring ( msie+5, ua.indexOf ( ".", msie ) ) )
  290.     else
  291.         return 0    // is other browser
  292. }